package java_DesignPattern.BehavioralPattern.Chain_of_responsibilityPattern;

/**
 * 组长类
 */
public class Temer extends Handler {

    //构造方法
    public Temer() {
        super(0, Handler.ONE);
    }

    @Override
    public void handleRequest(Leave leave) {
        //如果没有下一个处理器，或者请假天数在处理范围之内
        if (nextHandler != null && leave.getNum() <= Handler.ONE ) {
            System.out.println("组长审批：" + leave.getName() + "请假" + leave.getNum() + "天，" + leave.getContent());
        } else {
            //否则，传递给下一个处理器
            nextHandler.handleRequest(leave);
        }
    }
}
